package com.itheima.controller;


import com.itheima.pojo.OmsOrderSetting;
import com.itheima.service.OmsOrderSettingService;
import com.itheima.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

//订单设置

@RestController
@RequestMapping("orderSetting")
public class OmsOrderSettingController {


    @Autowired
    private OmsOrderSettingService omsOrderSettingService;


    /**
     * 修改指定订单设置
     * @param id
     * @param omsOrderSetting
     * @return
     */
    @PostMapping("update/{id}")
    public Result updateById(@PathVariable("id") Integer id,@RequestBody OmsOrderSetting omsOrderSetting){

        omsOrderSettingService.updateById(id,omsOrderSetting);
        return Result.success(null);
    }


    /**
     * 获取指定订单设置
     * @param id
     * @return
     */
    @GetMapping("{id}")
    public Result getOrderSetting(@PathVariable("id") Integer id){
        OmsOrderSetting omsOrderSetting = omsOrderSettingService.getOrderSetting(id);
        return Result.success(omsOrderSetting);
    }
}
